home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / chooser / 3dmenu.tru next >
Text File  |  1994-08-02  |  2KB  |  66 lines

  1. external
  2. ! main menu loop for d3 demos
  3. module d3
  4. DECLARE PUBLIC d3pts(,),d3txt$()
  5. sub d3_demos
  6.  
  7.     call draw_d3
  8.     call waitup
  9.     do
  10.         call getclick_d3(op)
  11.     if op=1 then
  12.         chain "!cd ../demos/3d;../../basic/tru -i topo3.tru &",return
  13.     elseif op=2 then
  14.         chain "!cd ../demos/3d;../../basic/tru -i bars3.tru &",return
  15.     elseif op=3 then 
  16.         chain "!cd ../demos/3d;../../basic/tru -i about3d.tru &",return
  17.     elseif op=4 then
  18.         chain "!cd ../demos/3d;../../basic/tru -i zbar3.tru &",return
  19.     elseif op=0 then
  20.         exit sub
  21.     end if
  22.     if op<>0 and op<>-1 then
  23.                 call expand(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4))
  24.    draw textbox(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4),d3txt$(op))
  25.                 call waitup
  26.         pause 3
  27.               call unexpand(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4))
  28.    draw textbox(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4),d3txt$(op))
  29.     end if
  30.  
  31.     if refresh(1)=1 then 
  32.         call draw_d3
  33.     end if
  34.     loop
  35. end sub
  36.  
  37. sub draw_d3
  38.         let u=ubound(d3pts,1)
  39.         clear
  40.         for i=1 to u
  41.                 draw d3box(i)
  42.         next i
  43.         box keep 0,1,0,1 in d3box$
  44. end sub
  45.  
  46. picture d3box(op)
  47.     draw box(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4),op)
  48.    draw textbox(d3pts(op,1),d3pts(op,2),d3pts(op,3),d3pts(op,4),d3txt$(op))
  49. end picture
  50.  
  51. sub getclick_d3(op)
  52.         get mouse x,y,state
  53.         let op=-1
  54.         if state<>0 and x>=0 and x<=1 and y>=0 and y<=1 then
  55.            let u=ubound(d3pts,1)
  56.        let op=0
  57.            for i=1 to u
  58.                 if x>d3pts(i,1) and x<d3pts(i,2) and y>d3pts(i,3) and y<d3pts(i,4) then
  59.                         let op=i
  60.                         exit sub
  61.                 end if
  62.            next i
  63.         end if
  64. end sub
  65. end module
  66.